<template>
  <el-input v-model="crud.query[select]" placeholder="请输入内容" class="input-with-select" style="width: 400px;">
    <el-select slot="prepend" v-model="select" placeholder="请选择搜索条件" @change="handleChange">
      <el-option v-for="(item, index) in options" :key="index" :label="item.label" :value="item.queryname" />
    </el-select>
  </el-input>
</template>
<script>
import { generalsearch } from '@crud/crud'
export default {
  name: 'CompositeInput',
  mixins: [generalsearch()],
  props: {
    options: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      select: ''
    }
  },
  methods: {
    handleChange() {
      this.crud.resetQuery(false)
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-select .el-input {
  width: 140px;
}
/deep/ .input-with-select .el-input-group__prepend {
  background-color: #fff;
}
</style>
